package com.example.vv.model.main.base.adapter;


import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.ArrayList;

public class FragmentAdapter extends FragmentPagerAdapter {


    private ArrayList<Fragment> fragment_list;//存放ViewPager下的Fragment

    public FragmentAdapter(FragmentManager fm) {
        super(fm);

        this.fragment_list = new ArrayList<>();
    }
   public void addFragment(Fragment fragment){
       fragment_list.add(fragment);
   }
    @Override
    public Fragment getItem(int position) {
        return fragment_list.get(position);
    }

    @Override
    public int getCount() {
        return fragment_list.size();
    }


}